From: Florian Müllner Date: Tue, 17 Dec 2019 00:01:13 +0000 (+0100) Subject: popupMenu: Close when source actor gets hidden X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~781^2^2~289 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=35494f5d08;p=gnome-shell.git popupMenu: Close when source actor gets hidden If a menu is anchored to a source actor, it is odd to leave it floating around when the source actor gets hidden. Close the menu instead in that case. https://gitlab.gnome.org/GNOME/gnome-shell/issues/2002 --- diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index c3e763b36..56638050f 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -814,7 +814,12 @@ var PopupMenu = class extends PopupMenuBase { if (this.sourceActor) { this._keyPressId = this.sourceActor.connect('key-press-event', - this._onKeyPress.bind(this)); + this._onKeyPress.bind(this)); + this._notifyMappedId = this.sourceActor.connect('notify::mapped', + () => { + if (!this.sourceActor.mapped) + this.close(); + }); } this._systemModalOpenedId = 0; @@ -928,6 +933,9 @@ var PopupMenu = class extends PopupMenuBase { if (this._keyPressId) this.sourceActor.disconnect(this._keyPressId); + if (this._notifyMappedId) + this.sourceActor.disconnect(this._notifyMappedId); + if (this._systemModalOpenedId) Main.layoutManager.disconnect(this._systemModalOpenedId); this._systemModalOpenedId = 0;